package com.itheima.Vue.web.manager.dao;

import com.itheima.Vue.web.manager.pojo.Contact;
import org.apache.ibatis.annotations.*;

import java.util.HashMap;
import java.util.List;

public interface ContactDao {

    //@Select("select * from contact limit #{index},#{count}")
    List<Contact> findListByPage(@Param("index") int index,
                                 @Param("count") int count,
                                 @Param("map") HashMap<String, String> conditionMap);

    //@Select("select count(*) from contact")
    int findContactSum(@Param("map") HashMap<String, String> conditionMap);


    @Insert("insert into contact values(null,#{name},#{sex},#{age},#{address},#{qq},#{email})")
    public void addContact(Contact contact);

    @Update("update contact set name=#{name},sex=#{sex},age=#{age},address=#{address},qq=#{qq},email=#{email} " + " where id=#{id}")
    public void updateContact(Contact contact);

    @Select("select * from contact where id = #{id}")
    Contact getContactById(int id);

    @Delete("delete from contact where id = #{id}")
    void deleteContactById(int id);
}
